package org.ice4apps.talk.dao;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Extension entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "extension", catalog = "icetalk", uniqueConstraints = @UniqueConstraint(columnNames = { "user",
                                                                                                     "extension" }))
public class Extension implements java.io.Serializable {
    // Fields
    private String   id;
    private TalkUser talkUser;
    private String   extension;
    private Long     creationdate;
    private Long     updationdate;

    // Constructors
    /** default constructor */
    public Extension () {
    }

    /** minimal constructor */
    public Extension (String id,
                      TalkUser talkUser,
                      String extension,
                      Long creationdate) {
        this.id = id;
        this.talkUser = talkUser;
        this.extension = extension;
        this.creationdate = creationdate;
    }

    /** full constructor */
    public Extension (String id,
                      TalkUser talkUser,
                      String extension,
                      Long creationdate,
                      Long updationdate) {
        this.id = id;
        this.talkUser = talkUser;
        this.extension = extension;
        this.creationdate = creationdate;
        this.updationdate = updationdate;
    }

    // Property accessors
    @Id
    @Column(name = "id", unique = true, nullable = false, length = 36)
    public String getId () {
        return this.id;
    }

    public void setId (String id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user", nullable = false)
    public TalkUser getTalkUser () {
        return this.talkUser;
    }

    public void setTalkUser (TalkUser talkUser) {
        this.talkUser = talkUser;
    }

    @Column(name = "extension", nullable = false, length = 8)
    public String getExtension () {
        return this.extension;
    }

    public void setExtension (String extension) {
        this.extension = extension;
    }

    @Column(name = "creationdate", nullable = false)
    public Long getCreationdate () {
        return this.creationdate;
    }

    public void setCreationdate (Long creationdate) {
        this.creationdate = creationdate;
    }

    @Column(name = "updationdate")
    public Long getUpdationdate () {
        return this.updationdate;
    }

    public void setUpdationdate (Long updationdate) {
        this.updationdate = updationdate;
    }
}